public class Solution453 {
    public int minMoves(int[] nums) {
        int t=Integer.MAX_VALUE;
        int total=0;
        for (int num : nums) {
            if (num<t){
                t=num;
            }
            total+=num;
        }
        return total-t*nums.length;
    }

    public static void main(String[] args) {
        System.out.println(new Solution453().minMoves(new int[]{1,2,3}));
    }
}
